package io.geekidea.springboot.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.JsonNode;
import io.geekidea.springboot.handler.CustomJacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

@Getter
@Setter
@TableName("building")
@Schema(name = "Building", description = "设施信息表")
public class Building {

    @TableId(type = IdType.AUTO)
    @Schema(description = "主键ID")
    @Excel(isColumnHidden = true,name="ID")
    private Long id;

    @NotBlank(message = "设施类型不能为空")
    @Schema(description = "设施类型")
    private Long type;

    @NotBlank(message = "设施名称不能为空")
    @Schema(description = "设施名称")
    @Excel(name = "设施名称")
    private String name;

    @TableField(exist = false)
    @Schema(description = "设施类型名称")
    @Excel(name = "类型名称")
    private String typeName;

    @NotNull(message = "经度不能为空")
    @Schema(description = "经度")
    @Excel(name = "经度")
    private Double longitude;

    @NotNull(message = "纬度不能为空")
    @Schema(description = "纬度")
    @Excel(name = "纬度")
    private Double latitude;

    @NotBlank(message = "简介不能为空")
    @Schema(description = "简介")
    @Excel(name = "简介")
    private String introduction;

    @TableField(typeHandler = CustomJacksonTypeHandler.class)
    @Schema(description = "动态属性")
    @Excel(name = "动态属性")
    private JsonNode properties;

    @Schema(description = "管线")
    @Excel(name = "管线")
    private String lines;

    @Schema(description = "创建时间")
    @Excel(name = "创建时间",exportFormat="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;


    @Schema(description = "更新时间")
    @Excel(name = "更新时间",exportFormat="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;
}
